/**
 * test case for api_payment_history
 */
describe("api_payment_history", function() {
	beforeEach(function() {
		App.initSession();
		App.getSession().setTimeStamp(new Date());
	});

	describe('bsoi paymentHistory', function() {
		var account = App.HaveAccount.create();
		var callback = jasmine.createSpy();
		
		beforeEach(function() {
			spyOn(bsoi, "paymentHistory").andCallFake(function() {
				t_paymentHistoryResponse = {
					"transactionHistoryList": [
			            {
			                "exchangeRate": 1,
			                "purposeOfTransfer": "Online Fund Transfer",
			                "transactionId": "PK-011-111001-085012012-623118-015",
			                "transferDate": "2011-11-24T05:30:00.000+0530",
			                "fromAccountNumber": "22510815452",
			                "toAccountNumber": "22539552026",
			                "currencyCode": "PKR",
			                "amount": 140.23,
			                "transactionStatus": "SCHD",
			                "transactionType": "Between Own Accounts",
			                "fromAccountCurrencyCode": "PKR",
			                "toAccountCurrencyCode": "PKR",
			                "isCCY": false,
			                "actualTransAmt": 140.23,
			                "remitanceAmount": 140.23,
			                "fromAccountAmount": 140.23,
			                "toAccountAmount": 140.23
			            },
			            {
			                "exchangeRate": 1,
			                "purposeOfTransfer": "Online Fund Transfer",
			                "transactionId": "PK-011-111001-084203523-217055-013",
			                "transferDate": "2011-10-21T05:30:00.000+0530",
			                "fromAccountNumber": "22539552026",
			                "toAccountNumber": "10000111622",
			                "currencyCode": "PKR",
			                "amount": 120.66,
			                "transactionStatus": "SCHD",
			                "transactionType": "Between Own Accounts",
			                "fromAccountCurrencyCode": "PKR",
			                "toAccountCurrencyCode": "PKR",
			                "isCCY": false,
			                "actualTransAmt": 120.66,
			                "remitanceAmount": 120.66,
			                "fromAccountAmount": 120.66,
			                "toAccountAmount": 120.66
			            },
			            {
			                "exchangeRate": 1,
			                "purposeOfTransfer": "Online Inter Bank Fund Transfer",
			                "transactionId": "PK-013-111001-132115275-193109-006",
			                "transferDate": "2011-10-20T05:30:00.000+0530",
			                "fromAccountNumber": "18000111614",
			                "toAccountNumber": "4563982000385591",
			                "payeeName": "ASAD AHMED BURNEY",
			                "currencyCode": "PKR",
			                "amount": 123,
			                "transactionStatus": "SCHD",
			                "transactionType": "Local Transfer (Outside the Bank)",
			                "payeeId": 9160712982346440000,
			                "destinationAccountName": "Model Bank IBFT",
			                "fromAccountCurrencyCode": "PKR",
			                "toAccountCurrencyCode": "PKR",
			                "isCCY": false,
			                "actualTransAmt": 123,
			                "remitanceAmount": 123,
			                "fromAccountAmount": 123,
			                "toAccountAmount": 123,
			                "bankName": "Model Bank"
			            },
			            {
			                "exchangeRate": 1,
			                "purposeOfTransfer": "Online Fund Transfer",
			                "transactionId": "PK-012-111001-131543943-709776-004",
			                "transferDate": "2011-10-12T05:30:00.000+0530",
			                "fromAccountNumber": "22539552026",
			                "toAccountNumber": "4563982000385591",
			                "payeeName": "BATOOL HUSAIN BATALVI",
			                "currencyCode": "PKR",
			                "amount": 2000,
			                "transactionStatus": "SCHD",
			                "transactionType": "Local Transfer (Within the Bank)",
			                "payeeId": 1005732359247623600,
			                "destinationAccountName": "SCBPAYEE1",
			                "fromAccountCurrencyCode": "PKR",
			                "toAccountCurrencyCode": "PKR",
			                "isCCY": false,
			                "actualTransAmt": 2000,
			                "remitanceAmount": 2000,
			                "fromAccountAmount": 2000,
			                "toAccountAmount": 2000,
			                "bankName": "STANDARD CHARTERED BANK"
			            },
			            {
			                "exchangeRate": 1,
			                "purposeOfTransfer": "Online Fund Transfer",
			                "transactionId": "PK-011-111001-121124084-660835-001",
			                "transferDate": "2011-10-08T00:00:00.000+0530",
			                "fromAccountNumber": "18000111602",
			                "toAccountNumber": "01000111625",
			                "currencyCode": "PKR",
			                "amount": 300,
			                "transactionStatus": "SCHD",
			                "transactionType": "Between Own Accounts",
			                "fromAccountCurrencyCode": "PKR",
			                "toAccountCurrencyCode": "PKR",
			                "isCCY": false,
			                "actualTransAmt": 300,
			                "remitanceAmount": 300,
			                "fromAccountAmount": 300,
			                "toAccountAmount": 300
			            }
			        ],
			        "responseHeader": {
			            "status": 1,
			            "currentTimestamp": "2011-10-01T18:58:32.368+0530",
			            "nonce": "19fe20d28e32348181a874f93e883608"
			        }
				}
				App.api_paymentHistory._processPaymentHistory(t_paymentHistoryResponse);
			});
		});

		it('User can get payment history', function() {
			spyOn(account, "get");
			spyOn(App.api_paymentHistory, "_processPaymentHistory");

			App.api_paymentHistory.getPaymentHistory(account, callback);
			
			expect(App.api_paymentHistory.callbackPaymentHistory).toEqual(callback);
			expect(bsoi.paymentHistory).toHaveBeenCalled();
			
			expect(App.api_paymentHistory._processPaymentHistory).toHaveBeenCalledWith(t_paymentHistoryResponse);
		});
		
	});

});
